package com.tyust.dao;

import org.junit.Ignore;
import org.junit.Test;
import sun.text.resources.cldr.lg.FormatData_lg;

import javax.jws.soap.SOAPBinding;
import java.util.Scanner;

import static org.junit.Assert.*;

public class UserDaoTest {
    //
    UserDao userDao;

    public UserDaoTest() {
        userDao = new UserDao();
    }

    @Test
    public void insertUser() {
        UserDao userDao = new UserDao();
        int flag = userDao.insertUser("wanghaitao","t1ab90");
        if(flag == 1){
            System.out.println("注册成功");
        }else{
            System.out.println("失败");
        }
    }

    @Test
    public void login() {
        UserDao userDao = new UserDao();
       /* Scanner scanner = new Scanner(System.in);
        System.out.println("请输入用户名");
        //接收键盘上输入的内容
        String uname = scanner.next();
        System.out.println("请输入密码");
        String upsw = scanner.next();*/

        boolean flag = userDao.login("wanghaitao","t1ab90");

        if(flag == true){
            System.out.println("wanghaitao" + "登录成功");
        }else{
            System.out.println("登录失败");
        }
    }

    @Test
    public void deleteUsers() {
        int i = userDao.deleteUser(50);
        System.out.println("test"+i);
        if(i == 1){
            System.out.println("删除成功");
        }else{
            System.out.println("删除失败");
        }
    }

    @Test
    public void updateUser() {
        UserDao userDao = new UserDao();
        int flag = userDao.updateUser(3,"lll","hhhhh");
        System.out.println(flag);
    }

    @Test
    public void selectAllUser() {
        UserDao userDao = new UserDao();
        System.out.println(userDao.selectAllUser());
    }
}